package org.scs.carleton.ca.pgdt.core;

import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;

/**
 * The PrologCore is the central hub of the prolog framework.
 * 
 * @author tessierj
 *
 */
public class PrologCore extends Plugin {
	private ASTProvider astProvider;
	
	// The plug-in ID
	public static final String PLUGIN_ID = "org.scs.carleton.ca.pgdt.core"; //$NON-NLS-1$
	
	// The shared instance
	private static PrologCore plugin;
	
	/**
	 * The constructor
	 */
	public PrologCore() {
		astProvider = new ASTProvider();
	}
	
	/*
	 * (non-Javadoc)
	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
	 */
	public void start(BundleContext context) throws Exception {
		super.start(context);
		plugin = this;
	}

	/*
	 * (non-Javadoc)
	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
	 */
	public void stop(BundleContext context) throws Exception {
		plugin = null;
		super.stop(context);
	}
	
	public ASTProvider getASTProvider() {
		return astProvider;
	}
	
	/**
	 * Returns the shared instance
	 *
	 * @return the shared instance
	 */
	public static PrologCore getDefault() {
		return plugin;
	}
}
